package com.asset.dispoal.dicData;

import com.asset.dispoal.dicData.api.GbDictDataService;
import com.asset.dispoal.dicData.dto.GbDictDataRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.mhuang.pacebox.springboot.core.permission.annotation.Permission;
import tech.mhuang.pacebox.springboot.protocol.Result;
import tech.mhuang.pacebox.springboot.protocol.data.PageVO;

;

/**
 * @author qr
 * @date 2022/2/24$
 */
@RestController
@Api(value = "字典详情配置", tags = "字典详情配置")
@RequestMapping("sys/gbDicData")
public class GbDicDataController {
    @Autowired
    GbDictDataService gbDictDataService;

    @Permission(code = "dictionaryType:add")
    @PostMapping("insert")
    @ApiOperation(value = "添加字典详情", notes = "添加字典详情")
    public Result insert(@RequestBody GbDictDataRequest gbDicRequest) {
        gbDictDataService.insert(gbDicRequest);
        return Result.ok();
    }

    @Permission(code = "dictionaryType:del")
    @PostMapping("delete")
    @ApiOperation(value = "删除字典详情", notes = "删除字典详情")
    public Result delete(@RequestBody String id) {
        gbDictDataService.delete(id);
        return Result.ok();
    }

    @Permission(code = "dictionaryType:update")
    @PostMapping("update")
    @ApiOperation(value = "修改字典详情", notes = "修改字典详情")
    public Result update(@RequestBody GbDictDataRequest gbDictDataRequest) {
        gbDictDataService.update(gbDictDataRequest);
        return Result.ok();
    }

    @Permission(code = "dictionaryType:query")
    @PostMapping("queryPage")
    @ApiOperation(value = "分页查询字典", notes = "分页查询字典")
    public Result<PageVO> queryPage(@RequestBody GbDictDataRequest gbDictDataRequest) {
        return gbDictDataService.queryPage(gbDictDataRequest);
    }

}
